package de.graffiti.beans;

import java.util.Vector;
import de.graffiti.interfaces.Wallpaper;
import de.graffiti.interfaces.WallpaperService;

public class WallpaperBean
{

	private Integer wallpaperid;
	private de.graffiti.interfaces.Wallpaper wallpaper;
	private Vector<de.graffiti.interfaces.Wallpaper> wallpaperList;

	WallpaperService wpservice;

	public WallpaperBean()
	{
		DBConnection db = new DBConnection();
		wpservice = (WallpaperService) db.getService("WallpaperServiceBean/remote", WallpaperService.class);

	}

	public Vector<de.graffiti.interfaces.Wallpaper> getWallpaperList()
	{
		if (wallpaperList == null)
			wallpaperList = wpservice.getAll();
		return wallpaperList;

	}

	public String edit()
	{
		if (wallpaperid != null)
		{
			wallpaper = (Wallpaper) wpservice.getWallpaper(wallpaperid);
		}
		return "edit";
	}

	public String show()
	{
		if (wallpaperid != null)
		{
			wallpaper = (Wallpaper) wpservice.getWallpaper(wallpaperid);
		}
		return "link";
	}

	public Integer getWallpaperid()
	{
		return wallpaperid;
	}

	public void setWallpaperid(Integer wallpaperid)
	{
		this.wallpaperid = wallpaperid;
	}

	public void setWallpaper(de.graffiti.interfaces.Wallpaper wallpaper)
	{
		this.wallpaper = wallpaper;
	}

	public de.graffiti.interfaces.Wallpaper getWallpaper()
	{
		return wallpaper;
	}

}
